<!DOCTYPE html>
<html>

<?php 

require_once("DB_Config.php");
require_once("func.php");
$db_connect = DB_Connection::getInstance();


?>

<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<link href="css/style.css" rel='stylesheet' type='text/css' />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.package-slider.js"></script>
<script type="text/javascript" src="js/jquery.dropdown.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"></script>
<!--

     ____.                     _________            .__        __   
    |    |____ ___  _______   /   _____/ ___________|__|______/  |_ 
    |    \__  \\  \/ /\__  \  \_____  \_/ ___\_  __ \  \____ \   __\
/\__|    |/ __ \\   /  / __ \_/        \  \___|  | \/  |  |_> >  |  
\________(____  /\_/  (____  /_______  /\___  >__|  |__|   __/|__|  
              \/           \/        \/     \/         |__|         


-->
<script type="text/javascript">

function appar_size() {
    var e = document.getElementById("rsize");
    if ( isNaN(e.value) || (e.value > 600) || (e.value < 0) ) {
        alert("invalid number, please enter numbet between 0-600");
        e.value="";
    }
}


//chaecking that the minimum price range is correct
function p_range_min() {
    var e = document.getElementById("prangemin");
    if ( isNaN(e.value) || (e.value < 99) || (e.value > 50000000) ) {
        alert("invalid price , please enter price between 100 - 50000000");
        e.value="";
    }
    else{
        var x =  e.value;
    }
}

$(function() { $( "#datetab" ).datepicker( {  maxDate: "+0D" ,dateFormat: 'yy-mm-dd'} );  } );

//case district been changed and need to change to city select

function cit() {   
    var e = document.getElementById("district");
    var dis_name = e.options[e.selectedIndex].value;
    var flag=1;  //recognaizing in data.php who called him
     $('#city').load('data.php?dis_name=' + escape(dis_name) + '&flag=' + escape(flag)) ;
}


function googlego(){

  var district = document.getElementById("district");
  var city = document.getElementById("city");
  var apparstr = document.getElementById("apparstr");
  
  var flag=4;  
    if ( !(district.value == '') && !(city.value == '') && !(apparstr.value == '') ) {

      var district = document.getElementById("district");
      var city = city.value;
      var apparstr = apparstr.value;
      
     // $('#andrei').load('data.php?city=' + escape(city) + '&apparstr=' + escape(apparstr) + '&flag=' + escape(flag)) ;

     $.get('data.php?city=' + escape(city) + '&apparstr=' + escape(apparstr) + '&flag=' + escape(flag), function(data) {
     $('#cordinates').val(data);
      });
    }
  }

$(document).ajaxComplete(function() {

  initialize();

});


function initialize(){
  var cor = document.getElementById("cordinates").value;
  var n=cor.split(",");
  if (n[0]!="xxxxxxxxxx" && n[0]!=""){
    var myCenter=new google.maps.LatLng(n[0],n[1]);
    var marker;
    var mapProp = { center:new google.maps.LatLng(n[0],n[1]), zoom:17, mapTypeId:google.maps.MapTypeId.ROADMAP };
    var map=new google.maps.Map(document.getElementById("map_show"),mapProp);
    marker=new google.maps.Marker({ position:myCenter, animation:google.maps.Animation.BOUNCE });
    marker.setMap(map);
  }  

}


 
</script>



<script type="text/javascript">

var street_eng_regex = /^[-.,;: A-Za-z0-9]*$/;
var street_heb_regex = /^[\u0591-\u05F4]{2,15}[\,\. ]? ?([0-9]+)?$/;
//case district been changed and need to change to city select

function cit() {   
    var e = document.getElementById("district");
    var dis_name = e.options[e.selectedIndex].value;
    var flag=1;  //recognaizing in data.php who called him
     $('#city').load('data.php?dis_name=' + escape(dis_name) + '&flag=' + escape(flag)) ;
}

//case number of minimum rooms been change so we need to update the max num of rooms
function min_room() {   
    var e = document.getElementById("num_of_room");
    var minroom = e.options[e.selectedIndex].value;
    var flag=2;  //recognaizing in data.php who called him
     $('#max_num_room').load('data.php?minroom=' + escape(minroom) + '&flag=' + escape(flag)) ;
}

//case number of minimum floor been change so we need to update the max num of floor
function floor_range() {   
    var e = document.getElementById("floor");
    var min_floor = e.options[e.selectedIndex].value;
    var flag=3;  //recognaizing in data.php who called him
     $('#maxfloor').load('data.php?min_floor=' + escape(min_floor) + '&flag=' + escape(flag)) ;
}

//fixing the appartment size to be legal  address_check
function appar_size() {
    var e = document.getElementById("rsize");
    if ( isNaN(e.value) || (e.value > 600) || (e.value < 0) ) {
        document.getElementById('rsize_error').innerHTML="Ivalid number, please enter numbet between 0-600 !";
        e.value="";
    }
    else{ document.getElementById('rsize_error').innerHTML=""; }
}

//check if address is legel 
function address_check() {
    var e = document.getElementById("addres");
    if (  ( (!street_eng_regex.test( e.value)) && (!street_heb_regex.test(e.value))) ){
    	 document.getElementById('addres_error').innerHTML="Ivalid Address, please enter street name and number !";
    	 e.value="";
    }
    else{ document.getElementById('addres_error').innerHTML=""; }
}

//chaecking that the minimum price range is correct
function p_range_min() {
    var e = document.getElementById("price");
    if ( isNaN(e.value) || (e.value < 99) || (e.value > 50000000) ) {
        document.getElementById('price_error').innerHTML="Ivalid price ,please enter price between 99-50000000 !";
        e.value="";
    }
    else{
    	document.getElementById('price_error').innerHTML="";
        var x =  e.value;
        x++;
        var e = document.getElementById("prangemax");
        e.value=x;
    }
}
$(function() {
    $( "#datetab" ).datepicker({  maxDate: "+0D" ,dateFormat: 'yy-mm-dd'});
  });

window.onload = function () {
    var e = document.getElementById("city");
    var city_name = e.options[e.selectedIndex].value;
        e = document.getElementById("district");
    var dis_name = e.options[e.selectedIndex].value;
    var flag=5;  //recognaizing in data.php who called him
    $('#city').load('data.php?city_name=' + escape(city_name) + '&dis_name=' + escape(dis_name) + '&flag=' + escape(flag)) ;
    googlego();
	}
</script>

<title>A&A ONLINE HOUSE SHOWER</title>
</head>


<body>
	<!-- START HEADER WRAPER-->
		
			<div id="header-wrapper">
				<?php require_once("header.php"); 
					if(isset($_SESSION['myusername'])==FALSE)  { header("location:index.php");} 
					else {?> <b class="hellouser"> Hello <?php echo $_SESSION['myusername']; ?></b> <?php $myusername=$_SESSION['myusername']; } ?>
			</div>
		
		<!-- START CONTENT WRAPER-->
		<div id="page-wrapper">
			<div id="page-content">

				<!-- END CONTENT WRAPER-->

				

<!--

___________    .___.__  __    __________                                         .___
\_   _____/  __| _/|__|/  |_  \______   \_______   ____   ______ ______ ____   __| _/
 |    __)_  / __ | |  \   __\  |     ___/\_  __ \_/ __ \ /  ___//  ___// __ \ / __ | 
 |        \/ /_/ | |  ||  |    |    |     |  | \/\  ___/ \___ \ \___ \\  ___// /_/ | 
/_______  /\____ | |__||__|    |____|     |__|    \___  >____  >____  >\___  >____ | 
        \/      \/                                    \/     \/     \/     \/     \/ 




-->
		
				<?php 
				if( isset($_POST['edit']) )
				{		
					//No Apartment Was Choosen - Stays On Same Page	
					if(empty($_POST['ad_id'])){
					?> <div class="show_table" style="padding: 10px 0px 10px 0px;"><?php
					echo "&nbsp &nbsp You haven't choose a ad to edit<br>";
					?> </div><?php
						}

						else{
							$edit_flag = 1;
							$str = $_POST['ad_id'];
							$str = explode(',',$str,2);

							$ad_id = $str[0];
							$adkind = $str[1];
							
							?> <div class="show_table" style="padding: 10px 0px 10px 0px;"><?php
							echo "&nbsp &nbsp Now you can edit ad data of ad: ".$ad_id."<br>";
							?> </div>
							<div class="show_table" style="padding: 10px 0px 10px 0px; overflow:hidden;">


							<?php //Bring The Ad From The DB To UI
								if ($adkind == "partner") { $sql1="SELECT * FROM partnerhouse WHERE ad_id=?"; $type='partnerhouse';}
								if ($adkind == "rent")    { $sql1="SELECT * FROM renthouse    WHERE ad_id=?"; $type='renthouse'   ;}
								if ($adkind == "sell")    { $sql1="SELECT * FROM sellhouse    WHERE ad_id=?"; $type='sellhouse'   ;}

	                            $stmt = $db_connect->db_conn->prepare($sql1);	
	                            $param = array($ad_id);

								if ($stmt->execute($param)){
	                                 $ans = $stmt->fetch(PDO::FETCH_ASSOC); 


	                             }

							?>

								<!--
							___________                   
							\_   ________________  _____  
							 |    __)/  _ \_  __ \/     \ 
							 |     \(  <_> |  | \|  Y Y  \
							 \___  / \____/|__|  |__|_|  /
							     \/                    \/
								-->


<form name="rent_registration_form" method="post" action="rent_reg.php" style=" height: 490px; width: 1000px; ">
	<input type="hidden" name="adid" value="<?php echo $ad_id; ?>">
    <table class="regtlb" dir="ltr">
    <i style="margin-left: 222px;">Please Insert Your Property Properties</i>
    </table>
    
    <div class="subjects"><!-- START TABLE -->
	
        <table class="regtlb" dir="ltr">
            <tr>
                <td class="show_header"><b class="show_text">APARTMENT PROPERTIES</b></td>
            </tr>
        </table>


          <td width="242" valign="top"><!-- APARTMENT PROPERTIES -->
              <table width="245" border="0" align="left" cellpadding="0" cellspacing="0">
                <tr>        
                  <td width="65" style="padding-right: 10px">District:</td>


                    <td> <!-- APARTMENT DISTRICT -->
                         <select id="district" name="district" style="width: 100px;" onchange="cit()">
                           <option value="0"> </option>
                            <?php
                                        $db_connect = DB_Connection::getInstance();
                                        $q = 'SELECT DISTINCT district  FROM cities';
                                        $stmt = $db_connect->db_conn->prepare($q);
                                        if ($stmt->execute()){
                                             $res = $stmt->fetchAll(PDO::FETCH_ASSOC);
                                             $i = 0; 
                                             while ($i < count($res)) {                     
                                ?>
                                
                            <option value= "<?php  echo $res[$i]['district']; ?>" 
                            				<?php  if( $ans['district']==$res[$i]['district']){?> selected="selected" <?php  }?> >
                                            <?php  echo $res[$i]['district']; ?> 

                            </option>
                            <?php   $i++; } } ?>
                        </select>
                  </td>
                </tr>  <!-- APARTMENT DISTRICT END -->  

                <tr>    <!-- APARTMENT CITY --> 
                  <td width="65" style="padding-right: 10px">City:</td>
                      <td>
                        <select id ="city" name="city" style="width: 130px;" onchange="googlego()"  >
                            <option selected="selected" value="<?php  echo $ans['city_name']; ?>">
                            	<?php  echo $ans['city_name']; ?>
                            </option>
                        </select>
                    </td>
                </tr>        

                <tr><!-- APARTMENT ROOMS --> 
                    <td width="65" style="padding-right: 10px"># of Rooms:</td>
                    <td> 
	                    <select id ="min_num_room" name="min_num_room" style="width: 55px;" onchange="">
	                    	<?php
	                    		for ($a = 1 ; $a < 13 ; $a++) { ?>
	                        		<option <?php if( $ans['num_bedrooms']==$a){?> selected="selected"<?php }?> value= "<?php echo $a ?>"   ><?php echo $a ?></option>
	                        		<option <?php if( $ans['num_bedrooms']==$a+0.5){?> selected="selected"<?php }?> value= "<?php echo $a+0.5 ?>"   ><?php echo $a+0.5 ?></option>
	                    	<?php } ?>
	                    </select>
                    </td>                                                                                                                                                                     
                </tr>

                <tr><!-- APARTMENT FLOORS --> 
                      <td width="65" style="padding-right: 10px">Floor #:</td>            
                        <td>
                            <select id ="minfloor" name="minfloor" style="width: 55px;" onchange="">
                            	<?php
	                    		for ($a = 1 ; $a < 20 ; $a++) { ?>
	                        		<option <?php if( $ans['floor']==$a){?> selected="selected"<?php }?> value= "<?php echo $a ?>"   ><?php echo $a ?></option>
	                        	<?php } ?>

                                <option <?php if( $ans['floor']==100){?> selected="selected"<?php }?> value="100">20+</option>
                            </select>
                        </td>
                     </tr>

                <tr><!-- APARTMENT SQUARE --> 
                  <td width="69" style="padding-right: 10px">Square&nbspFoot:</td>            
                    <td>
                     <input type="text" name="rsize" id="rsize" value="<?php echo $ans['square_feet']; ?>" style="width: 25px;" onchange="appar_size()">
                    </td>
                </tr>


                <tr><!-- APARTMENT PRICE --> 
                  <td width="69" style="padding-right: 10px">Price Range:</td>            
                    <td>
                     <input type="text" name="prangemin" id="prangemin" value="<?php echo $ans['price']; ?>" style="width: 60px;" onchange="p_range_min()">
                    </td>
                </tr>

                <tr><!-- PROPERTY TYPE --> 
                      <td width="63" style="padding-right: 10px">Type:</td>
                        <td>
                            <select id ="type" name="type" style="width: 80px;">
	                            <option <?php if( $type=="sellhouse"){?> selected="selected"<?php }?> value="sellhouse">Sell</option>
	                    		<option <?php if( $type=="renthouse"){?> selected="selected"<?php }?> value="renthouse">Rent</option>
	                    		<option <?php if( $type=="partnerhouse"){?> selected="selected"<?php }?> value="partnerhouse">Rent(Partners)</option>
                            </select>
                            <input type="hidden" id ="oldtype" name="oldtype" value="<?php echo $type; ?>" >
                        </td>
                    </tr>


                    <tr><!-- APARTMENT PUROSE --> 
                      <td width="63" style="padding-right: 10px">Purpose:</td>
                        <td>
                            <select id ="purpose" name="purpose" style="width: 80px;">
		                        <option <?php if( $ans['property']=="apartment"){?> selected="selected"<?php }?> value="apartment">Apartment</option>
		                        <option <?php if( $ans['property']=="studio"){?> selected="selected"<?php }?> value="studio">Studio</option>
		                        <option <?php if( $ans['property']=="penthouse"){?> selected="selected"<?php }?> value="penthouse">Penthouse</option>
		                        <option <?php if( $ans['property']=="basement"){?> selected="selected"<?php }?> value="basement">Basement</option>
		                        <option <?php if( $ans['property']=="duplex"){?> selected="selected"<?php }?> value="duplex">Duplex</option>
		                        <option <?php if( $ans['property']=="triplex"){?> selected="selected"<?php }?> value="triplex">Triplex</option>
		                        <option <?php if( $ans['property']=="housing_unit"){?> selected="selected"<?php }?> value="housing_unit">Housing unit</option>
		                        <option <?php if( $ans['property']=="warehouse"){?> selected="selected"<?php }?> value="warehouse">Warehouse</option>
		                        <option <?php if( $ans['property']=="residential_building"){?> selected="selected"<?php }?> value="residential_building">Residential building</option>
		                        <option <?php if( $ans['property']=="lot"){?> selected="selected"<?php }?> value="lot">Lot</option>
                            </select>
                        </td>
                    </tr> 

                    




              </table>
            </td>    
        </div>


        <!--

\_   ___ \  ____ |  |  __ __  _____   ____        \_____  \ 
/    \  \/ /  _ \|  | |  |  \/     \ /    \        /  ____/ 
\     \___(  <_> |  |_|  |  |  Y Y  |   |  \      /       \ 
 \______  /\____/|____|____/|__|_|  |___|  /      \_______ \
        \/                        \/     \/               \/

         -->  


    <div class="subjects"><!-- START TABLE -->

        <table class="regtlb" dir="ltr">
            <tr>
                <td class="show_header"><b class="show_text">APARTMENT PROPERTIES</b></td>
            </tr>
        </table>

          <td width="242" valign="top">
              <table width="245" border="0" align="left" cellpadding="0" cellspacing="0">

                <tr>        
                  <td width="120px" style="padding-right: 10px">Enter Date:</td>
                    <td> <!-- APARTMENT DATE -->
                        <input type="text" name="datetab" id="datetab" value="<?php echo $ans['entrance_date']; ?>" style="width: 80px;" onchange="">
                    </td>
                </tr>   

                <tr>        
                  <td width="100" style="padding-right: 10px">Street Name:</td>
                    <td> <!-- APARTMENT STREET -->
                        <input type="text" name="apparstr" id="apparstr" value="<?php echo $ans['address']; ?>" style="width: 80px;" onchange="googlego()">
                    </td>
                </tr>    

                <tr>    <!-- APARTMENT Warehouse --> 
                  <td width="65" style="padding-right: 10px">Warehouse:</td>
                      <td>
                        <input type="checkbox" name="Warehouse"  <?php if( $ans['warehouse']==1){?> checked<?php }?> value="1">
                    </td>
                </tr>

                <tr>    <!-- APARTMENT Parking --> 
                  <td width="65" style="padding-right: 10px">Parking:</td>
                      <td>
                        <input type="checkbox" name="Parking" <?php if( $ans['parking']==1){?> checked<?php }?>  value="1">
                    </td>
                </tr>  

                 <tr>    <!-- APARTMENT Parking --> 
                  <td width="75" style="padding-right: 10px">Air Conditioner:</td>
                      <td>
                        <input type="checkbox" name="air_conditioner" <?php if( $ans['air_conditioner']==1){?> checked<?php }?> value="1">
                    </td>
                </tr>  

                 <tr>    <!-- APARTMENT Elevator --> 
                  <td width="65" style="padding-right: 10px">Elevator:</td>
                      <td>
                        <input type="checkbox" name="Elevator" <?php if( $ans['elevator']==1){?> checked<?php }?> value="1">
                    </td>
                </tr> 
                 <tr>    <!-- APARTMENT Comments --> 
                  <td width="65" style="padding-right: 10px">Comments:</td>
                      <td>
                       <input type="text" name="Comments" value="<?php echo $ans['comments']; ?>">
                    </td>
                </tr> 
                <tr>    <!-- APARTMENT Comments --> 
                  <td width="65" style="padding-right: 10px">Cordinats:</td>
                      <td>
                       <input type="text" name="cordinates" id="cordinates" value="xxxxxxxxxx, xxxxxxxxx">
                    </td>
                </tr>
              </table> <!-- COLUMNS END -->
            </td>    
        </div>

<div class="subjects"><!-- GOOGLE MAP -->
  <div margin="0px 0px 0px 0px">
  <table class="regtlb" dir="ltr">
  <tr><td class="show_header"><b class="show_text">GOOGLE MAP</b></td></tr>
 </table>

<!-- Google Maps -->
          <td width="242" valign="top">
              <table  class="table_show" width="242" border="0" align="right" cellpadding="0" cellspacing="0">
                <tr>
                  <td colspan="3">
                    <div id="andrei" value="first"></div>
                    <div id="map_show" style="width:385px;height:180px;">
                    </div>         
                </td> 
              </tr>
          </table>
        </td>   
      </div>
    </div><!-- GOOGLE MAP END -->

<td><input name="Submit" type="submit" value="Submit" class="button" /></td>

</form>






						 	
<!--
							___________                   
							\_   ________________  _____  
							 |    __)/  _ \_  __ \/     \ 
							 |     \(  <_> |  | \|  Y Y  \
							 \___  / \____/|__|  |__|_|  /
							     \/                    \/
								-->



	                        </div>
					   </div>

							<?php
						}
				 ?>
				 <?php } ?>

				 
<!--

__________                                    __________                                       .___
\______   \ ____   _____   _______  __ ____   \______   _______  ____   ______ ______ ____   __| _/
 |       __/ __ \ /     \ /  _ \  \/ _/ __ \   |     ___\_  __ _/ __ \ /  ___//  ____/ __ \ / __ | 
 |    |   \  ___/|  Y Y  (  <_> \   /\  ___/   |    |    |  | \\  ___/ \___ \ \___ \\  ___// /_/ | 
 |____|_  /\___  |__|_|  /\____/ \_/  \___  >  |____|    |__|   \___  /____  /____  >\___  \____ | 
        \/     \/      \/                 \/                        \/     \/     \/     \/     \/




-->
				
				<!-- ________________________remove ad been pressed___________________________________ -->
				<?php 
				if( isset($_POST['remove']) )
				{?> <div class="show_table" style="padding: 10px 0px 10px 0px;"><?php
						if(empty($_POST['ad_id'])){echo "&nbsp &nbsp You haven't choose a ad to remove<br>";}//user haven't been choose
						else{ //deliting 
							$edit_flag = 0;
							$str = $_POST['ad_id'];
							$str = explode(',',$str,2);
							$ad_id = $str[0];
							$adkind = $str[1];

							if ($adkind == "partner"){ $sql="DELETE FROM partnerhouse WHERE ad_id=?";}
							if ($adkind == "rent"){ $sql="DELETE FROM renthouse WHERE ad_id=?";}
							if ($adkind == "sell"){ $sql="DELETE FROM sellhouse WHERE ad_id=?";}
							$stmt = $db_connect->db_conn->prepare($sql);
							$param = array($ad_id);
							if ($stmt->execute($param)){
								echo $ad_id." have been deleted<br>";
							}
							else{
								echo $ad_id;
								echo "&nbspuser havent been deleted - ERROR<br>";
							}
							
						}
				 ?> </div><?php
				}
				?>
<!--
  ________.__                       _____                       __                        __         
 /   _____|  |__   ______  _  __   /  _  \ ___________ ________/  |_ _____   ____   _____/  |_ ______
 \_____  \|  |  \ /  _ \ \/ \/ /  /  /_\  \\____ \__  \\_  __ \   __/     \_/ __ \ /    \   __/  ___/
 /        |   Y  (  <_> \     /  /    |    |  |_> / __ \|  | \/|  ||  Y Y  \  ___/|   |  |  | \___ \ 
/_______  |___|  /\____/ \/\_/   \____|__  |   __(____  |__|   |__||__|_|  /\___  |___|  |__|/____  >
        \/     \/                        \/|__|       \/                 \/     \/     \/         \/ 


-->

				<?php 
				if( (!isset($_POST['edit']))  or  ( (empty($_POST['ad_id'])) and (isset($_POST['edit'])) ) ) {?>
				<!-- case of showing table of all appartment of the user -->
				<div class="show_table">
					<form name="edit_remove_form" id="edit_remove_form" method="post" action="edit_remove_apart.php" >
						<table id="xxxxxx" >
							<thead>
								<tr>
									<th class="thxx"></th>
									<th class="thxx">Ad Id</th>
									<th class="thxx">District</th>
									<th class="thxx">City Name</th>
									<th class="thxx">Address</th>
									<th class="thxx">Property</th>
									<th class="thxx">Price</th>
									<th class="thxx">kind</th>
								</tr>
							</thead>
							<tbody>

								<?php
								$sql="SELECT * FROM partnerhouse
							  	WHERE username= ? ";
								$stmt = $db_connect->db_conn->prepare($sql);
								$param=array($myusername);
								if($stmt->execute($param)){ 
								 	while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ ?> <!-- gets all the table rows -->
										<tr id="trxx">
											<td style="width:30px;"><input type="radio" name="ad_id" value=<?php echo $row['ad_id']; ?>,partner></td>
											<td class="tdxx"><?php echo $row['ad_id']; ?></td>
											<td class="tdxx"><?php echo $row['district']; ?></td>
											<td class="tdxx"><?php echo $row['city_name']; ?></td>
											<td class="tdxx"><?php echo $row['address']; ?></td>
											<td class="tdxx"><?php echo $row['property']; ?></td>											
											<td class="tdxx"><?php echo $row['price']; ?></td>
											<td class="tdxx">partner house</td>										
										</tr>
									<?php }		//while end end
								} ?>

								<?php
								$sql="SELECT * FROM renthouse
							  	WHERE username= ? ";
								$stmt = $db_connect->db_conn->prepare($sql);
								$param=array($myusername);
								if($stmt->execute($param)){ 
								 	while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ ?> <!-- gets all the table rows -->
										<tr id="trxx">
											<td style="width:30px;"><input type="radio" name="ad_id" value=<?php echo $row['ad_id']; ?>,rent></td>
											<td class="tdxx"><?php echo $row['ad_id']; ?></td>
											<td class="tdxx" class="tdxx"><?php echo $row['district']; ?></td>
											<td class="tdxx"><?php echo $row['city_name']; ?></td>
											<td class="tdxx"><?php echo $row['address']; ?></td>
											<td class="tdxx"><?php echo $row['property']; ?></td>											
											<td class="tdxx"><?php echo $row['price']; ?></td>
											<td class="tdxx">rent house</td>										
										</tr>
									<?php }		//while end end
								} ?>

								<?php
								$sql="SELECT * FROM sellhouse
							  	WHERE username= ? ";
								$stmt = $db_connect->db_conn->prepare($sql);
								$param=array($myusername);
								if($stmt->execute($param)){ 
								 	while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ ?> <!-- gets all the table rows -->
										<tr id="trxx">
											<td style="width:30px;"><input type="radio" name="ad_id" value=<?php echo $row['ad_id']; ?>,sell></td>
											<td class="tdxx"><?php echo $row['ad_id']; ?></td>
											<td class="tdxx"><?php echo $row['district']; ?></td>
											<td class="tdxx"><?php echo $row['city_name']; ?></td>
											<td class="tdxx"><?php echo $row['address']; ?></td>
											<td class="tdxx"><?php echo $row['property']; ?></td>											
											<td class="tdxx"><?php echo $row['price']; ?></td>
											<td class="tdxx">sell house</td>										
										</tr>
									<?php }		//while end end
								} ?>
							</tbody>
						</table>

						<input name="edit" type="submit" value="Edit" class="ad" id="ad">
						<input name="remove" type="submit" value="Remove" class="ad" id="ad" onclick="if (confirm('Are you sure you want to remove apartment from the list ?')) { e.action='edit_remove_apart.php'; e.submit(); } else { return false; }">
						<input name="back" type="submit" value="Back" class="ad" id="ad" onclick="var e = document.getElementById('edit_remove_form'); e.action='client.php'; e.submit();">
					</form>
				</div>
				<?php } ?>
			</div>
		</div>
		<!-- START FOOTER WRAPER-->
		<p><?php require("footer.php"); ?></p>
	</body>
</html>

